﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

    xmlns:ctrls="clr-namespace:BreadcrumbLib.Controls"
		xmlns:themes="clr-namespace:BreadcrumbLib.Themes"
    >
  <ResourceDictionary.MergedDictionaries>
    <ResourceDictionary Source="/BreadcrumbLib;component/Themes/Default/Buttons.xaml" />
    <ResourceDictionary Source="/BreadcrumbLib;component/Themes/Default/ComboboxNullAsSeparatorStyle.xaml" />
    <ResourceDictionary Source="/BreadcrumbLib;component/Themes/Default/Brushes.xaml" />
	</ResourceDictionary.MergedDictionaries>

  <Style x:Key="{x:Type ctrls:DropDownList}" TargetType="{x:Type ctrls:DropDownList}">
		<Setter Property="Background" Value="{DynamicResource {x:Static themes:ResourceKeys.ControlBackground}}" />
		<Setter Property="Foreground" Value="{DynamicResource {x:Static themes:ResourceKeys.ControlForeground}}" />
		<Setter Property="BorderBrush" Value="{DynamicResource {x:Static themes:ResourceKeys.ControlBorderBrush}}" />
    <Setter Property="HeaderButtonTemplate" Value="{StaticResource BaseToggleButton}" />
    <Setter Property="BorderThickness" Value="1" />
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type ctrls:DropDownList}">
          <ctrls:DropDown IsDropDownOpen="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
                          Background="{TemplateBinding Background}"
                          BorderBrush="{TemplateBinding BorderBrush}"
                          BorderThickness="{TemplateBinding BorderThickness}" 
                                      
                          HorizontalOffset="{TemplateBinding HorizontalOffset}"
                          VerticalOffset="{TemplateBinding VerticalOffset}"
                          Placement="{TemplateBinding Placement}" 
                          PlacementTarget="{TemplateBinding PlacementTarget}"
                                      
                          Header="{Binding Header,RelativeSource={RelativeSource TemplatedParent}}"
                          HeaderButtonTemplate="{Binding HeaderButtonTemplate,RelativeSource={RelativeSource TemplatedParent}}"            
          >
            <ScrollViewer VerticalScrollBarVisibility="Auto">
              <StackPanel Orientation="Vertical">
                <ItemsPresenter x:Name="ItemsPresenter" 
                                        KeyboardNavigation.DirectionalNavigation="Contained" 
                                        SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
              </StackPanel>
            </ScrollViewer>
          </ctrls:DropDown>

        </ControlTemplate>
      </Setter.Value>
    </Setter>
    <Setter Property="ItemContainerStyle" Value="{StaticResource ComboboxNullCancelButton}" />
  </Style>

</ResourceDictionary>